package com.xbao.dao;

import com.xbao.model.AskAbsent;
import com.xbao.model.req.AskAbsentReq;
import com.xbao.model.vo.AskAbsentVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AskAbsentExtraMapper {
    @Select("<script>select a.*,b.name as  stuname,c.name as clsname  from ask_absent as a left join stu as b on a.sid=b.id left join cls as c on a.cid=c.id" +
            "<where>" +
            "<if test=\"stuname!=null and stuname !=''\">and a.name like  concat('%',#{stuname},'%') </if>" +
            "<if test=\"cid!=null and cid !=''\">and a.cid =#{cid} </if>" +
            "<if test=\"status!=null and status !=''\">and a.status =#{status} </if>" +
            "<if test=\"eid!=null and eid !=''\">and c.eid =#{eid} </if>" +
            "<if test=\"query_begintime!=null and query_begintime !=null \"> and a.createtime &gt;= #{query_begintime} and a.createtime &lt; #{query_endtime} </if>" +
            "</where>"+
            " </script>")
            public List<AskAbsentVo> queryList(AskAbsentReq req);
}
